package com.yc.ycbook.read.fragment

import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.yc.ycbook.R
import com.yc.ycbook.base.BaseFragment
import com.yc.yclibx.adapter.YcAdapterHelper
import com.yc.yclibx.adapter.YcRecyclerViewAdapter
import kotlinx.android.synthetic.main.read_book_mark_fragment.*

/**
 *  书签
 */
class ReadBookMarkFragment : BaseFragment() {
    companion object {
        fun newInstance(): Fragment {
            return ReadBookMarkFragment()
        }
    }

    override fun getLayoutId(): Int {
        return R.layout.read_book_mark_fragment
    }

    private lateinit var mAdapter: YcRecyclerViewAdapter<String>
    override fun initView() {
        mAdapter = object : YcRecyclerViewAdapter<String>(context) {
            override fun onUpdate(helper: YcAdapterHelper, item: String, position: Int) {
                helper.setText(R.id.ycItemDefaultTv, "测试：$position")
            }
        }
        for (i in 0..130) {
            mAdapter.add("item：$i");
        }
        readBookMarkRv.layoutManager =
            LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
        readBookMarkRv.adapter = mAdapter

    }
}